//
//  CountdownTimer.h
//  YYDJProject
//
//  Created by 赵亚会 on 2024/6/12.
//
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, TimerMode) {
    TimerModeCountdown,//倒计时
    TimerModeCountup//正向计时
};
  
typedef void(^TimerUpdateBlock)(NSInteger elapsedOrRemainingSeconds);
typedef void(^TimerCompletionBlock)(void);

@interface CountTimer : NSObject
@property (nonatomic,assign) NSInteger duration;
- (instancetype)initWithDuration:(NSInteger)duration
                            mode:(TimerMode)mode
                     updateBlock:(TimerUpdateBlock)updateBlock
                 completionBlock:(TimerCompletionBlock)completionBlock;

- (void)start;
- (void)stop;
- (void)reset;
-(BOOL)isTimerRunning;
@end

NS_ASSUME_NONNULL_END
